package com.wang.designpattern.prototype.deepclone;

public class Client {
    public static void main(String[] args) throws CloneNotSupportedException {
        DeepPropotype deepPropotype = new DeepPropotype();
        deepPropotype.setName("123");
        deepPropotype.deepcloneTarget = new DeepcloneTarget("大牛", "A类");
        // 方式1深拷贝:clone
        //DeepPropotype deepPropotype2 = (DeepPropotype) deepPropotype.clone();
        // 方式2深拷贝:序列化
        DeepPropotype deepPropotype2 = (DeepPropotype) deepPropotype.deepClone();
        System.out.println(deepPropotype.name + ", " + deepPropotype.deepcloneTarget.hashCode());
        System.out.println(deepPropotype2.name + ", " + deepPropotype2.deepcloneTarget.hashCode());
    }
}
